feat: Adds openTelemetry Collector resource#2520
Conversation
WalkthroughAdds a NamespacedResource-backed OpenTelemetryCollector resource that builds and validates its spec and registers the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
Hi @adolfo-ab @myakove @rnetser please review this PR, Thanks! |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
ocp_resources/open_telemetry_collector.py (1)
71-71: Mask potentially sensitivespec.configin logs.Collector configs often embed credentials/endpoints. Hashing this field in log output avoids accidental leakage.
# End of generated code + + @property + def keys_to_hash(self) -> list[str]: + # Mask the entire collector config in logs + return ["spec>config"]
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
ocp_resources/open_telemetry_collector.py(1 hunks)ocp_resources/resource.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/open_telemetry_collector.py (2)
ocp_resources/resource.py (4)
NamespacedResource(1532-1642)ApiGroup(466-574)to_dict(735-739)to_dict(1640-1642)ocp_resources/exceptions.py (1)
MissingRequiredArgumentError(5-10)
🔇 Additional comments (3)
ocp_resources/resource.py (1)
533-533: LGTM: API group added correctly.
OPENTELEMETRY_IOconstant matches the expected API group and integrates cleanly with the dynamic version discovery.ocp_resources/open_telemetry_collector.py (2)
14-14: LGTM: Correct API group assignment.Using
NamespacedResource.ApiGroup.OPENTELEMETRY_IOis the right hook for this CRD.
49-54: Fix error messages and avoid forcingmanagement_state.
- Use parameter names without
self.inMissingRequiredArgumentErrorfor clearer UX.- Don’t raise if
management_stateis omitted; include it only when provided to avoid generating invalid specs for distributions that don’t support it.- if not self.kind_dict and not self.yaml_file: - if self.config is None: - raise MissingRequiredArgumentError(argument="self.config") - - if self.management_state is None: - raise MissingRequiredArgumentError(argument="self.management_state") + if not self.kind_dict and not self.yaml_file: + if self.config is None: + raise MissingRequiredArgumentError(argument="config")⛔ Skipped due to learnings
Learnt from: servolkov PR: RedHatQE/openshift-python-wrapper#2490 File: ocp_resources/route_advertisements.py:53-65 Timestamp: 2025-08-11T16:42:29.245Z Learning: In the openshift-python-wrapper project, when raising MissingRequiredArgumentError, the convention is to include the "self." prefix in the argument name (e.g., `MissingRequiredArgumentError(argument="self.advertisements")`). This pattern is established in the code generator template at `class_generator/manifests/class_generator_template.j2` and followed consistently across most resource classes.
|
/retest all |
|
/retest tox |
|
/retest all |
|
@kpunwatk pre-commit check failed, Please fix it |
new file: ocp_resources/open_telemetry_collector.py modified: ocp_resources/resource.py new file: ocp_resources/open_telemetry_collector.py modified: ocp_resources/resource.py
Head branch was pushed to by a user without write access
df41268 to
c03e5de
Compare
|
Done @myakove , thanks! |
|
/approve |
|
/verified |
|
/verified |
|
/approve |
Adds openTelemetry resource to the wrapper
Short description:
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:
Summary by CodeRabbit